package object_;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class Test5 {
    public static void main(String[] args) {
        String path="D:\\javacode\\javacode\\IO_1\\pain.txt";

        BufferedWriter bufferedWriter=null;
        String data="怎麽办，明天考试了！";
        try {

            bufferedWriter=new BufferedWriter(new FileWriter(path));
            bufferedWriter.write(data);

        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {
                bufferedWriter.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
